package com.hqd.ch03.v45.context.ui.support;

import com.hqd.ch03.v45.context.ui.HierarchicalThemeSource;
import com.hqd.ch03.v45.context.ui.Theme;
import com.hqd.ch03.v45.context.ui.ThemeSource;

public class DelegatingThemeSource implements HierarchicalThemeSource {

    private ThemeSource parentThemeSource;

    @Override
    public ThemeSource getParentThemeSource() {
        return this.parentThemeSource;
    }

    @Override
    public void setParentThemeSource(ThemeSource parentThemeSource) {
        this.parentThemeSource = parentThemeSource;
    }

    @Override
    public Theme getTheme(String themeName) {
        if (this.parentThemeSource != null) {
            return this.parentThemeSource.getTheme(themeName);
        } else {
            return null;
        }
    }

}
